//
//  UIBarButtonItem+Extension.swift
//  Weibo
//
//  Created by 李亚乐 on 15/12/17.
//  Copyright © 2015年 李亚乐. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    
    convenience init(imageName: String, target: AnyObject?, actionName: String?) {
        
        let button = UIButton(imageName: imageName, backgroundImageName: nil)
        
        // 判断 actionName
        if let actionName = actionName {
            button.addTarget(target, action: Selector(actionName), forControlEvents: .TouchUpInside)
        }
        
        self.init(customView: button)

    }
}
